package Text3;
import java.util.*;
public class Main {
    public static void main(String[] args) {
//        给定一个长度为 n 的数列，请你求出数列中每个数的二进制表示中 1 的个数。
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]= scanner.nextInt();
        }
        for (int i = 0; i < n; i++) {
            func(arr[i]);
        }
    }

    public static void func(int n){
        int count=0;
        while(n>0){
            n=n&(n-1);
            count++;
        }
        System.out.print(count+" ");
    }
}
